<!DOCTYPE html>
<html lang="zh"xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>首页 - 天才(genius)后台管理系统</title>
    <link rel="icon" th:href="@{favicon.ico}" type="image/ico">
    <link href="css/bootstrap.min.css" th:href="@{~/css/bootstrap.min.css}" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" th:href="@{~/css/materialdesignicons.min.css}" rel="stylesheet">
    <link href="css/style.min.css" th:href="@{~/css/style.min.css}" rel="stylesheet">
    <!--标签插件-->
    <link rel="stylesheet" th:href="@{~/js/jquery-tags-input/jquery.tagsinput.min.css}" href="js/jquery-tags-input/jquery.tagsinput.min.css">
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside th:include="left :: common" class="lyear-layout-sidebar">
        </aside>
        <!--End 左侧导航-->
        <!--头部信息-->
        <header th:include="head :: common" class="lyear-layout-header">
        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">
            <form action="/study-role/roleadd" method="post" id="save_emp">
                <div class="container-fluid">

                    <div class="row">
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-body">

                                    <form action="#!" method="post" class="row">
                                        <div class="form-group col-md-6">
                                            <label >创建人</label>
                                            <input type="hidden" name="roleCreateId" th:value="${session.USER.id}">
                                            <input type="text" disabled="disabled" class="form-control" th:value="${session.USER.empName}"/>
                                        </div>
                                        <div class="form-group col-md-12">
                                            <label >角色名称</label>
                                            <input type="text" class="form-control" th:onblur="save()" onblur="save()" id="empName" name="roleName"  placeholder="请输入角色名称" />



                                        <div class="form-group col-md-12 alert alert-danger" role="alert"  hidden="true" id="msg"></div>
                                            <div class="table-responsive">
                                                <table class="table table-striped">
                                                    <thead>
                                                    <tr>
                                                        <th>
                                                            <label class="lyear-checkbox checkbox-primary">
                                                                <input name="checkbox" type="checkbox" id="check-all">
                                                                <span> 全选</span>
                                                            </label>
                                                        </th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr th:each="list1,index1:${list}"  >
                                                        <td th:if="${list1.menuCategory} eq 1">
                                                            <label class="lyear-checkbox checkbox-primary">
                                                                <input name="menuroleid" type="checkbox" class="checkbox-parent"  th:value="${list1.id}">
                                                                <span > [[${list1.menuName}]]</span>
                                                            </label>
                                                        </td>
                                                        <td class="p-l-20" th:if="${list1.menuCategory} eq 2">
                                                            <label class="lyear-checkbox checkbox-success m-t-10">
                                                                <input name="menuroleid" type="checkbox" class="checkbox-child"  th:value="${list1.id}">
                                                                <span> [[${list1.menuName}]]</span>
                                                            </label>
                                                        </td>
                                                        <td class="p-l-40" th:if="${list1.menuCategory} eq 3">
                                                            <label class="lyear-checkbox checkbox-yellow m-t-10">
                                                                <input name="menuroleid" type="checkbox" class="checkbox-child"  th:value="${list1.id}">
                                                                <span> [[${list1.menuName}]]</span>
                                                            </label>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>


                                        <button type="button" class="btn btn-primary" id="svemp" data-toggle="modal" data-target=".bs-example-modal-sm">保存</button>

                                        <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
                                            <div class="modal-dialog modal-sm" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                                                        <h4 class="modal-title" id="myLargeModalLabel">员工新增</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        是否确认添加😊
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                                        <button type="button" onclick="add()" class="btn btn-primary">点击保存</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <button type='button' class='btn btn-default' onclick="javascript:history.back(-1);return false;">返 回</button>

                                    </form>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </main>
    </div>

</div>
</div>
<script type="text/javascript" th:src="@{~/js/jquery.min.js}" src="js/jquery.min.js"></script>
<script type="text/javascript" th:src="@{~/js/bootstrap.min.js}" src="js/bootstrap.min.js"></script>
<script type="text/javascript" th:src="@{~/js/perfect-scrollbar.min.js}" src="js/perfect-scrollbar.min.js"></script>
<script src="/js/jconfirm/jquery-confirm.min.js" th:src="@{~/js/jconfirm/jquery-confirm.min.js}"></script>
<script type="text/javascript" th:src="@{~/js/main.min.js}" src="js/main.min.js"></script>

<!--图表插件-->
<script type="text/javascript" th:src="@{~/js/Chart.js}" src="js/Chart.js"></script>
<script type="text/javascript">
    // $(function(){
    //     //动态选择框，上下级选中状态变化
    //     $('input.checkbox-parent').on('change', function(){
    //         var dataid = $(this).attr("dataid");
    //         $('input[dataid^=' + dataid + '-]').prop('checked', $(this).is(':checked'));
    //     });
    //     $('input.checkbox-child').on('change', function(){
    //         var dataid = $(this).attr("dataid");
    //         dataid = dataid.substring(0, dataid.lastIndexOf("-"));
    //         var parent = $('input[dataid=' + dataid + ']');
    //         if($(this).is(':checked')){
    //             parent.prop('checked', true);
    //             //循环到顶级
    //             while(dataid.lastIndexOf("-") != 2){
    //                 dataid = dataid.substring(0, dataid.lastIndexOf("-"));
    //                 parent = $('input[dataid=' + dataid + ']');
    //                 parent.prop('checked', true);
    //             }
    //         }else{
    //             //父级
    //             if($('input[dataid^=' + dataid + '-]:checked').length == 0){
    //                 parent.prop('checked', false);
    //                 //循环到顶级
    //                 while(dataid.lastIndexOf("-") != 2){
    //                     dataid = dataid.substring(0, dataid.lastIndexOf("-"));
    //                     parent = $('input[dataid=' + dataid + ']');
    //                     if($('input[dataid^=' + dataid + '-]:checked').length == 0){
    //                         parent.prop('checked', false);
    //                     }
    //                 }
    //             }
    //         }
    //     });
    // });
    // function empName() {
    //     save();
    // }
    //
    // function save() {
    //     $("#svemp").attr({"disabled":"disabled"});
    //     var roleName =$("#roleName").val();
    //
    //
    //     if(roleName==""||roleName==undefined){
    //         $("#msg").html("角色名称不能为空").show();
    //         setTimeout(function () {
    //             $("#msg").hide();
    //         }, 3000);
    //         return
    //     }
    //     $("#svemp").removeAttr("disabled");
    // }


    function add() {
        $("#save_emp").submit();
    }
</script>
</body>
</html>